<div class="row">
    <div class="am-u-sm-12 am-u-md-12 am-u-lg-12">
        <div class="widget am-cf">
            <div class="widget-head am-cf">
                <div class="widget-title am-cf">商城分红设置列表</div>
            </div>
            <div class="widget-body am-fr">
                <!-- 工具栏 -->
                <div class="page_toolbar am-margin-bottom-xs am-cf">
                    <form id="form-search" class="toolbar-form" action="">
                        <input type="hidden" name="s" value="/<?= $request->pathinfo() ?>">
                        <div class="am-u-sm-2 am-u-md-2">
                        </div>
                        <div class="am-u-sm-12 am-u-md-12">
                            <div class="am fr">
                                <div class="am-form-group am-fl">
                                    <?php $status = $request->get('status'); ?>
                                    <select name="status"
                                            data-am-selected="{btnSize: 'sm', placeholder: '分红开启状态'}">
                                        <option value=""></option>
                                        <option value="-1"
                                            <?= $status === '-1' ? 'selected' : '' ?>>全部
                                        </option>
                                        <?php foreach ($bonusList as $key=>$val): ?>
                                            <option value="<?= $key ?>"
                                                <?= $key == $status ? 'selected' : '' ?>><?= $val ?>
                                            </option>
                                        <?php endforeach; ?>
                                    </select>
                                </div>
                                <div class="am-form-group am-fl">
                                    <?php $moneyStatus = $request->get('money_status'); ?>
                                    <select name="money_status"
                                            data-am-selected="{btnSize: 'sm', placeholder: '零钱抵扣状态'}">
                                        <option value=""></option>
                                        <option value="-1"
                                            <?= $moneyStatus === '-1' ? 'selected' : '' ?>>全部
                                        </option>
                                        <?php foreach ($moneyList as $key=>$val): ?>
                                            <option value="<?= $key ?>"
                                                <?= $key == $moneyStatus ? 'selected' : '' ?>><?= $val ?>
                                            </option>
                                        <?php endforeach; ?>
                                    </select>
                                </div>



                                <div class="am-form-group am-fl">
                                    <div class="am-input-group am-input-group-sm tpl-form-border-form">
                                        <input type="text" class="am-form-field" name="search"
                                               placeholder="商户名称" value="<?= $request->get('search') ?>">
                                        <div class="am-input-group-btn">
                                            <button class="am-btn am-btn-default am-icon-search"
                                                    type="submit"></button>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </form>
                </div>
                <div class="am-u-sm-12">
                    <table width="100%" class="am-table am-table-compact am-table-striped tpl-table-black ">
                        <thead>
                        <tr>
                            <th>商城名称</th>
                            <th>分红状态</th>
                            <th>开始时间</th>
                            <th>到期时间</th>
                            <th>分红条件(元)</th>
                            <th>分红上限(%)</th>
                            <th>分红拨比(%)</th>
                            <th>零钱开关</th>
                            <th>抵扣比例</th>
                            <th>期数</th>
                        </tr>
                        </thead>
                        <tbody>
                        <?php if (!$list->isEmpty()): foreach ($list as $item): ?>
                            <tr>

                                <td class="am-text-middle">
                                    <p class="item-title"><?= $item['wxapp']['wxapp_name'] ?></p>
                                </td>


                            <?php if($item['status']==1): ?>
                                <td class="am-text-middle">
                                <span class="x-color-green">开启中</span>
                                </td>
                                <td class="am-text-middle"><?= format_time($item['start_time']) ?></td>
                                <td class="am-text-middle"><?= format_time($item['end_time']) ?></td>
                                <td class="am-text-middle"><?= $item['money'] ?></td>
                                <td class="am-text-middle"><?= $item['upline'] ?></td>
                                <td class="am-text-middle"><?= $item['rewardpercent'] ?></td>
                            <?php else:?>
                                <td class="am-text-middle">
                                    <span class="x-color-red">未开启</span>

                                </td>
                                <td class="am-text-middle">--</td>
                                <td class="am-text-middle">--</td>
                                <td class="am-text-middle">--</td>
                                <td class="am-text-middle">--</td>
                                <td class="am-text-middle">--</td>
                            <?php endif; ?>
                                <?php if($item['moneypercentstatus']==1): ?>
                                    <td class="am-text-middle">
                                        <span class="x-color-green">开启中</span>
                                    </td>
                                    <td class="am-text-middle"><?= $item['moneypercent'] ?></td>

                                <?php else:?>
                                    <td class="am-text-middle">
                                        <span class="x-color-red">未开启</span>
                                    </td>
                                    <td class="am-text-middle">--</td>
                                <?php endif; ?>
                                <td class="am-text-middle"><?= $item['periods_num'] ?></td>


                            </tr>
                        <?php endforeach; else: ?>
                            <tr>
                                <td colspan="4" class="am-text-center">暂无记录</td>
                            </tr>
                        <?php endif; ?>
                        </tbody>
                    </table>
                </div>
                <div class="am-u-lg-12 am-cf">
                    <div class="am-fr"><?= $list->render() ?> </div>
                    <div class="am-fr pagination-total am-margin-right">
                        <div class="am-vertical-align-middle">总记录：<?= $list->total() ?></div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>


